/*Цитировать выделенный текст*/
var txt = ''

function copyQ(nick) { 
	txt = ''
	if (document.getSelection) {
		txt = document.getSelection()
	} else
	if (document.selection) {
		txt = document.selection.createRange().text;
	}
	if (txt!='')
		txt = '[quote=' + nick + ']' + txt + '[/quote]\n'
}

function insertAtCaret (textObj, textFieldValue) { 
	if (document.all) {
		if (textObj.createTextRange && textObj.caretPos && !window.opera) {
			var caretPos = textObj.caretPos;
			caretPos.text = caretPos.text.charAt(caretPos.text.length - 1) == ' ' ?textFieldValue + ' ' : textFieldValue;
		} else {
			textObj.value += textFieldValue;
		}
	} else {
		if (textObj.selectionStart) {
			var rangeStart = textObj.selectionStart;
			var rangeEnd = textObj.selectionEnd;
			var tempStr1 = textObj.value.substring(0, rangeStart);
			var tempStr2 = textObj.value.substring(rangeEnd, textObj.value.length);
			textObj.value = tempStr1 + textFieldValue + tempStr2;
			textObj.selectionStart = textObj.selectionEnd = rangeStart + textFieldValue.length;
   
		} else {
			textObj.value += textFieldValue;
		}
	}
}

function pasteQ() {
    
	if (txt!='' && document.forms['post']['req_message'])
		insertAtCaret(document.forms['post']['req_message'], txt);
	document.forms['post']['req_message'].focus();

} 

function pasteN(text) { 
	if (text != '' && document.forms['post']['req_message'])
		insertAtCaret(document.forms['post']['req_message'], "[b]" + text + ",[/b] ");
	document.forms['post']['req_message'].focus();
}
/**********************************/

/*Попап окно*/
function PopUp(url, titre, largeur, hauteur, options) 
{
	var top=(screen.height-hauteur)/3;
	var left=(screen.width-largeur)/2;
	window.open(url, titre, "top="+top+", left="+left+", width="+largeur+", height="+hauteur+", "+options);
}